<?php
/**
 * 后台登录界面
 * 惠达浪专用版
 * 2019/04/14
 */

namespace plugins\crazy_admin_login;

use cmf\lib\Plugin;

class CrazyAdminLoginPlugin extends Plugin
{
    public $info = [
        'name'        => 'CrazyAdminLogin',
        'title'       => '后台登录界面',
        'description' => '后台登录界面惠达浪专用版',
        'status'      => 1,
        'author'      => '惠达浪',
        'version'     => '1.0.0',
        'demo_url'    => '',
        'author_url'  => 'https://www.qdcrazy.cc'
    ];

    public $hasAdmin = 0;

    /**
     * 安装
     * @return bool
     */
    public function install()
    {
        return true;
    }

    /**
     * 卸载
     * @return bool
     */
    public function uninstall()
    {
        return true;
    }

    /**
     * 实现admin_login钩子方法
     * @return string
     * @throws \Exception
     */
    public function adminLogin()
    {
        $site_info = cmf_get_site_info();
        $this->assign([
            'site_info' => $site_info,
            'copyright' => 'Copyright &copy; ' . date('Y') . '. ' . $site_info['site_name']
        ]);
        return $this->fetch('login');
    }
}